﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Person
{
    class Program
    {
        static void Main(string[] args)
        {
            var bus = "今天天气怎么样";
            
            
            Console.WriteLine( bus.IndexOf("天"));
            Console.WriteLine(bus.LastIndexOf("天"));
            Console.WriteLine(bus.Replace("今", "昨"));
            Console.WriteLine(bus.Substring(2, 5));
            Console.WriteLine(bus.Remove(2));


            var bug = Console.ReadLine();
            Console.WriteLine("字符串长度：" + bug.Length);

            string cut = Console.ReadLine();
            cut =cut.Insert (0, "好吧");
            Console.WriteLine("新的字符串为:" + cut);

            DateTime dt = DateTime.Now;
            Console.WriteLine("现在是："+dt.DayOfWeek +"\t"+ dt.DayOfYear);
            Console.WriteLine("加上1天后是："+dt.AddDays (1) );


            Console.WriteLine(dt.ToString("yyyy-MM-dd"));
            
            //计算日期之间差几天
            DateTime dt1 = Convert.ToDateTime("2007-08-15");
            DateTime dt2 = Convert.ToDateTime("2007-08-30");
            TimeSpan span = dt2.Subtract(dt1);
            int DayDiff = span.Days;
            Console.WriteLine(DayDiff);

            //计算一年几月有几天
            int Days = DateTime.DaysInMonth(2020, 2);
            Console.WriteLine(Days);


            Console.ReadKey();

        }
    }
}
